home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
MODULTUB.LZH
/
PROCTYPE.MOD
< prev
next >
Wrap
Text File
|
1989-01-18
|
2KB
|
60 lines
(* Chapter 13 - Program 10 *)
MODULE ProcType;
FROM InOut IMPORT WriteString, WriteLn;
VAR OutputStuff : PROCEDURE(ARRAY OF CHAR);
VarLine : ARRAY[0..50] OF CHAR;
PROCEDURE WriteWithNote(InString : ARRAY OF CHAR);
BEGIN
WriteString("Written with a note ---> ");
WriteString(InString);
WriteLn;
END WriteWithNote;
PROCEDURE WriteWithComment(InputLine : ARRAY OF CHAR);
BEGIN
WriteString(InputLine);
WriteString(" <--- Written with a comment");
WriteLn;
END WriteWithComment;
BEGIN
VarLine := "This is a line of data.";
(* This uses WriteWithNote *)
OutputStuff := WriteWithNote;
OutputStuff(VarLine);
OutputStuff("Extra output ");
(* This uses WiteWithComment *)
OutputStuff := WriteWithComment;
OutputStuff(VarLine);
(* This uses WriteString *)
OutputStuff := WriteString;
OutputStuff(VarLine);
OutputStuff(" End of the line");
WriteLn;
(* The Procedures can be used in normal fashion too *)
WriteLn;
WriteWithNote("This is straight output.");
WriteWithComment("This too is straight output.");
WriteString(VarLine);
END ProcType.
(* Result of execution
Written with a note ---> This is a line of data.
Written with a note ---> Extra output
This is a line of data. <--- Written with a comment
This is a line of data. End of the line
Written with a note ---> This is straight output.
This too is straight output. <--- Written with a comment
This is a line of data.
*)